<?

class osSwitch extends osGeneric {
	public $id = 'switch';
	public $tabs = array(
		'ipstats' => 'IP Stats',
		'interfaces' => 'Ports'
	);
	
	public $dataCollectors = array(
		'getIPStatistics',
		'getNetStatistics'
	);
	
	public function getResources() {
	
		// Operating System Information
		
		
		// Device Information
		foreach ($this->device->snmp->find('IF-MIB','ifIndex.([0-9]+)') AS $key=>$index) {
			$item = $this->device->snmp->find('IF-MIB','if([a-zA-z0-9]+).'.$index,true);
			$item = $item[$index];
			$item['device_id'] = $this->device->id;
			$interface = new objInterface($item);			
			$this->device->interfaces[$index] = $interface;
		}
	}
	public function getType() { return $this->device->os_type; }
	
	public function getPhysicalPortsCount() {
		$count = 0;
		foreach ($this->device->interfaces AS $interface) {
			switch ($interface->ifType) {
				case 117:
				case 6:
					$count++;
					break;
			}
		}
		return $count;
	}
	
	public function getPhysicalPorts() {
		$output = array();
		foreach ($this->device->interfaces AS $interface) {
			switch ($interface->ifType) {
				case 117:
				case 6:
					$output[] = $interface;
					break;
			}
		}
		return $output;
	}
	
	
}


?>